home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
TeX 1995 July
/
TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO
/
web
/
fweb
/
fweb-1.40
/
manual
/
demo3.web
< prev
next >
Wrap
Text File
|
1993-10-29
|
2KB
|
54 lines
@z --- demo3.web --
This file is part of FWEB. Its woven output is included into the user
manual fwebman.tex.
Author: J. A. Krommes
Version: 1.23
Date: April 1, 1992
@x-----------------------------------------------------------------------------
@c @* FORWARD REFERENCING. Here is a nonsense program illustrating forward
referencing for identifiers. Although there are various instances of
forward references, there was need for just one explicit~`\.{@@[}' command
(in module~3). Identifiers that are used in the same section as they are
defined are subscripted with a bullet. Note how the module-number
subscripts are set in different type for different kinds of identifiers.
Here we see that one can refer to the macros~|D| and~|W| as well as the
user-defined type~|PTR| in advance of their definition, yet they will
be subscripted properly.
@a
int main()
{
@<Typedefs@>@;
@<Special stuff@>@;
x = fcn(D(outer_test));
py = g(W(WEB_test));
}
@ Examples of definitions of an outer macro, a \WEB\ macro, and a function.
@d D(name) #name
@m W(arg) *arg++
@a
int fcn(char *name)
{}
@ In the following, we had to say ``\.{PTR\ @@[g\dots}'' in order to make
forward referencing to~|g| work. Although one can say things like
``\.{@@[int\ g\dots}'', it wouldn't work here to say ``\.{@@[PTR\ g\dots}''
because |PTR|~isn't known yet as a special type, even in phase~1.
@<Special...@>=
PTR @[g(int i)
{}
@ The compiler will see this |typedef| before any statements that use the
type |PTR|.
@<Type...@>=
typedef char *PTR;
@* INDEX.